<template>
  <div class="app-container calendar-list-container">
    <vue-editor 
      v-model="query.parameter"
      @imageAdded="editorUpload"
      useCustomImageHandler />
      <el-button type="primary" style="margin-top:40px" :loading="loading.edit" @click="updateParameter" >确定</el-button>
  </div>
    
  
</template>

<script>
import { VueEditor } from 'vue2-editor'
import { updateSystemParamter,getSystemParamter } from '@/api/system'
export default {
  name: 'system_novice',
  data () {
    return {
      loading: {
        edit: false
      },
      query: {
        systemType: 5,
        parameter: ''
      }
    }
  },
  components:{
    VueEditor
  },
  methods: {
    //富文本上传图片
    async editorUpload(file, Editor, cursorLocation, resetUploader) {
      if (file.size > 2 * 1024 * 1024) {
        this.$message.warning('图片不能大于2M')
        return
      }
      const formData = new FormData()
      formData.append('image', file)
      Editor.insertEmbed(cursorLocation, 'image', url);
      resetUploader();
    },

    // 获取提现说明
    async getParameter(){
      const { data } = await getSystemParamter({
        systemType:5,
      })
      this.query.parameter = data.parameter
    },
    
    //修改提现说明
    async updateParameter(){
      if(!this.query.parameter){
        this.$message.error('请输入内容');
        return
      }
      const { data } = await updateSystemParamter({
        systemType:5,
        parameter:this.query.parameter
      })
      this.$message.success('修改成功')
    }

  },
  created(){
    this.getParameter();
  }
}
</script>

<style>

</style>
